package org.example.simplemanagementsystem.mapper;


import org.apache.ibatis.annotations.*;
import org.example.simplemanagementsystem.pojo.Emp;
import org.example.simplemanagementsystem.pojo.EmpQueryParam;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    List<Emp> list(EmpQueryParam empQueryParam);
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into emp(username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) " +
            "values (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);

    void deleteByIds(List<Integer> ids);

    Emp getById(Integer id);

    void updateById(Emp emp);

    @MapKey("pos")
    List<Map<String, Object>> countEmpJobData();
    @MapKey("name")
    List<Map> countEmpGenderData();
    @Select("select id, username, name, password, gender, phone, job, salary, image, entry_date, create_time, update_time from emp")
    List<Emp> getList();
    @Select("select dept_id from emp where dept_id = #{id} limit 1")
    Emp getClazzId(Integer id);
}
